using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._Hydrology
{
    /// <summary>
    /// <para>Stream Order</para>
    /// <para>Assigns a numeric order to segments of a raster representing branches of a linear network.</para>
    /// <para>为表示线性网络分支的栅格线段分配数值顺序。</para>
    /// </summary>    
    [DisplayName("Stream Order")]
    public class StreamOrder : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public StreamOrder()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_stream_raster">
        /// <para>Input stream raster</para>
        /// <para><xdoc>
        ///   <para>An input raster that represents a linear stream network.</para>
        ///   <para>The input stream raster linear network should be represented as values greater than or equal to one on a background of NoData.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>表示线性流网络的输入栅格。</para>
        ///   <para>在 NoData 的背景上，输入流栅格线性网络应表示为大于或等于 1 的值。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_flow_direction_raster">
        /// <para>Input flow direction raster</para>
        /// <para><xdoc>
        ///   <para>The input raster that shows the direction of flow out of each cell.</para>
        ///   <para>The flow direction raster can be created using the Flow Direction tool, run using the default flow direction type D8.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>显示流出每个像元的方向的输入栅格。</para>
        ///   <para>可以使用流向工具创建流向栅格，该工具使用默认流向类型 D8 运行。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_raster">
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output stream order raster.</para>
        ///   <para>This output is of integer type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出流顺序栅格。</para>
        ///   <para>此输出为整数类型。</para>
        /// </xdoc></para>
        /// </param>
        public StreamOrder(object _in_stream_raster, object _in_flow_direction_raster, object _out_raster)
        {
            this._in_stream_raster = _in_stream_raster;
            this._in_flow_direction_raster = _in_flow_direction_raster;
            this._out_raster = _out_raster;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Stream Order";

        public override string CallName => "sa.StreamOrder";

        public override List<string> AcceptEnvironments => ["autoCommit", "cellSize", "cellSizeProjectionMethod", "compression", "configKeyword", "extent", "geographicTransformations", "mask", "outputCoordinateSystem", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_stream_raster, _in_flow_direction_raster, _out_raster, _order_method.GetGPValue()];

        /// <summary>
        /// <para>Input stream raster</para>
        /// <para><xdoc>
        ///   <para>An input raster that represents a linear stream network.</para>
        ///   <para>The input stream raster linear network should be represented as values greater than or equal to one on a background of NoData.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>表示线性流网络的输入栅格。</para>
        ///   <para>在 NoData 的背景上，输入流栅格线性网络应表示为大于或等于 1 的值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input stream raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_stream_raster { get; set; }


        /// <summary>
        /// <para>Input flow direction raster</para>
        /// <para><xdoc>
        ///   <para>The input raster that shows the direction of flow out of each cell.</para>
        ///   <para>The flow direction raster can be created using the Flow Direction tool, run using the default flow direction type D8.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>显示流出每个像元的方向的输入栅格。</para>
        ///   <para>可以使用流向工具创建流向栅格，该工具使用默认流向类型 D8 运行。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input flow direction raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_flow_direction_raster { get; set; }


        /// <summary>
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output stream order raster.</para>
        ///   <para>This output is of integer type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出流顺序栅格。</para>
        ///   <para>此输出为整数类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster { get; set; }


        /// <summary>
        /// <para>Method of stream ordering</para>
        /// <para><xdoc>
        ///   <para>The method used for assigning stream order.</para>
        ///   <bulletList>
        ///     <bullet_item>Strahler—The method of stream ordering proposed by Strahler in 1952. Stream order only increases when streams of the same order intersect. Therefore, the intersection of a first-order and second-order link will remain a second-order link, rather than creating a third-order link. This is the default.</bullet_item><para/>
        ///     <bullet_item>Shreve—The method of stream ordering by magnitude, proposed by Shreve in 1967. All links with no tributaries are assigned a magnitude (order) of one. Magnitudes are additive downslope. When two links intersect, their magnitudes are added and assigned to the downslope link.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于分配流顺序的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>Strahler - Strahler 于 1952 年提出的流排序方法。仅当相同顺序的流相交时，流顺序才会增加。因此，一阶链接和二阶链接的交集将保持二阶链接，而不是创建三阶链接。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>Shreve - 按量级排序的流方法，由 Shreve 于 1967 年提出。所有没有支流的链接都被分配了一个大小（数量级）1。量级是加性下坡。当两个链路相交时，它们的大小将被相加并分配给下坡链路。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Method of stream ordering")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _order_method_value _order_method { get; set; } = _order_method_value._STRAHLER;

        public enum _order_method_value
        {
            /// <summary>
            /// <para>Strahler</para>
            /// <para>Strahler—The method of stream ordering proposed by Strahler in 1952. Stream order only increases when streams of the same order intersect. Therefore, the intersection of a first-order and second-order link will remain a second-order link, rather than creating a third-order link. This is the default.</para>
            /// <para>Strahler - Strahler 于 1952 年提出的流排序方法。仅当相同顺序的流相交时，流顺序才会增加。因此，一阶链接和二阶链接的交集将保持二阶链接，而不是创建三阶链接。这是默认设置。</para>
            /// </summary>
            [Description("Strahler")]
            [GPEnumValue("STRAHLER")]
            _STRAHLER,

            /// <summary>
            /// <para>Shreve</para>
            /// <para>Shreve—The method of stream ordering by magnitude, proposed by Shreve in 1967. All links with no tributaries are assigned a magnitude (order) of one. Magnitudes are additive downslope. When two links intersect, their magnitudes are added and assigned to the downslope link.</para>
            /// <para>Shreve - 按量级排序的流方法，由 Shreve 于 1967 年提出。所有没有支流的链接都被分配了一个大小（数量级）1。量级是加性下坡。当两个链路相交时，它们的大小将被相加并分配给下坡链路。</para>
            /// </summary>
            [Description("Shreve")]
            [GPEnumValue("SHREVE")]
            _SHREVE,

        }

        public StreamOrder SetEnv(int? autoCommit = null, object cellSize = null, object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object mask = null, object outputCoordinateSystem = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, cellSize: cellSize, compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, mask: mask, outputCoordinateSystem: outputCoordinateSystem, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}